"""Runs all the tests in this directory.

Copyright 2009, Ian Blumel.
Mintec Inc.
"""

import sys
import os
import unittest

import config

def main():
    if __name__=="__main__":
        script_dir = os.path.dirname(__file__)
    else:
        script_dir = os.path.dirname(sys.argv[0])

    loader = unittest.defaultTestLoader
    listing = os.listdir(script_dir)
    all_suites =[]
    for l in listing:
        if l.endswith(".py"):
            name, _0 = os.path.splitext(l)
            mod = __import__(name)
            suite = loader.loadTestsFromModule(mod)
            all_suites.append(suite)

    runner = unittest.TextTestRunner()
    all_ = unittest.TestSuite(all_suites)
    result = runner.run(all_)

if __name__=="__main__":
    main()
